/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ccedeno
 */
@Entity
@Table(name = "inmuebles", catalog = "emilima_tradoc", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Inmuebles.findAll", query = "SELECT i FROM Inmuebles i"),
    @NamedQuery(name = "Inmuebles.findByIdInmu", query = "SELECT i FROM Inmuebles i WHERE i.idInmu = :idInmu"),
    @NamedQuery(name = "Inmuebles.findByDireccion", query = "SELECT i FROM Inmuebles i WHERE i.direccion = :direccion"),
    @NamedQuery(name = "Inmuebles.findByNombre", query = "SELECT i FROM Inmuebles i WHERE i.nombre = :nombre"),
    @NamedQuery(name = "Inmuebles.findByMarquezi", query = "SELECT i FROM Inmuebles i WHERE i.marquezi = :marquezi")})
public class Inmuebles implements Serializable {
    
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "id_inmu", nullable = false, length = 10)
    private String idInmu;
    @Size(max = 255)
    @Column(name = "direccion", length = 255)
    private String direccion;
    @Size(max = 150)
    @Column(name = "nombre", length = 150)
    private String nombre;
    @Size(max = 15)
    @Column(name = "marquezi", length = 15)
    private String marquezi;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "inmuebles", fetch = FetchType.LAZY)
    private List<Expediente> expedienteList;
    
    //@OneToMany(mappedBy = "inmuebles", fetch = FetchType.LAZY)
    //private List<Expediente> expedienteList;

    public Inmuebles() {
    }

    public Inmuebles(String idInmu) {
        this.idInmu = idInmu;
    }

    public String getIdInmu() {
        return idInmu;
    }

    public void setIdInmu(String idInmu) {
        this.idInmu = idInmu;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getMarquezi() {
        return marquezi;
    }

    public void setMarquezi(String marquezi) {
        this.marquezi = marquezi;
    }

    @XmlTransient
    public List<Expediente> getExpedienteList() {
        return expedienteList;
    }

    public void setExpedienteList(List<Expediente> expedienteList) {
        this.expedienteList = expedienteList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idInmu != null ? idInmu.hashCode() : 0);
        return hash;
    }
    
    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Inmuebles)) {
            return false;
        }
        Inmuebles other = (Inmuebles) object;
        if ((this.idInmu == null && other.idInmu != null) || (this.idInmu != null && !this.idInmu.equals(other.idInmu))) {
            return false;
        }
        return true;
    }
    
    @Override
    public String toString() {
       // return "Entidades.Inmuebles[ idInmu=" + idInmu + " ]";
         return  idInmu+" "+direccion;
    }
}
 